﻿using System.Windows;
using Model;
using Serilog;
using ZCommon;
using ZDriver;

namespace Launch;

/// <summary>
///     Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs e)
    {
        // 单例测试
        // Singleton<FlexibleService>.Generate("hello", "everyone");
        // Singleton<FlexibleService>.Instance();

        Initialize();

        base.OnStartup(e);
    }

    /// <summary>
    ///     初始化
    /// </summary>
    private void Initialize()
    {
        // 初始化日志
        ZLog.Initialize("myapp");
        
        // 串口驱动单例初始化
        var serialPort = Singleton<SerialPort_Driver>.Generate();
        
        // UDP驱动单例初始化
        var udpDriver = Singleton<Udp_Driver>.Generate();
        
        // 初始化数据解析单例
        var parser = Singleton<ProtocolParser>.Generate();
    }
}